<template>
    <div class="game-mode-container">
        <div class="game-mode-card">
            <div class="game-mode-header">
                <h1>选择游戏模式</h1>
            </div>

            <div class="game-mode-content">
                <div class="mode-selection">
                    <div class="mode-item" @click="selectMode('pve')">
                        <div class="mode-icon">
                            <el-icon>
                                <Cpu />
                            </el-icon>
                        </div>
                        <div class="mode-title">人机模式 (PVE)</div>
                        <div class="mode-description">与AI对战，提升你的技能</div>
                    </div>

                    <div class="mode-item" @click="selectMode('pvp')">
                        <div class="mode-icon">
                            <el-icon>
                                <User />
                            </el-icon>
                        </div>
                        <div class="mode-title">多人模式 (PVP)</div>
                        <div class="mode-description">与其他玩家在线对战</div>
                    </div>
                </div>
            </div>

            <div class="game-mode-footer">
                <button class="menu-btn" @click="goBack">
                    <el-icon>
                        <Back />
                    </el-icon>
                    返回主菜单
                </button>
            </div>
        </div>
    </div>
</template>

<script setup>
    import { useRouter } from 'vue-router'
    import { Back, Cpu, User } from '@element-plus/icons-vue'

    const router = useRouter()

    // 返回主菜单
    const goBack = () => {
        router.push('/')
    }

    // 选择游戏模式
    const selectMode = (mode) => {
        if (mode === 'pve') {
            router.push('/pve/')
        } else if (mode === 'pvp') {
            router.push('/pk/')
        }
    }
</script>

<style scoped>
    .game-mode-container {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100vh;
        width: 100vw;
    }

    .game-mode-card {
        width: 800px;
        background-color: rgba(0, 0, 0, 0.7);
        border-radius: 12px;
        padding: 30px;
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
        border: 1px solid rgba(255, 215, 0, 0.3);
        color: #fff;
        animation: fadeIn 0.5s ease-in-out;
        transform: scale(1);
        transition: transform 0.3s ease;
    }

    .game-mode-card:hover {
        transform: scale(1.01);
        box-shadow: 0 0 40px rgba(255, 215, 0, 0.5);
    }

    .game-mode-header {
        text-align: center;
        margin-bottom: 30px;
        border-bottom: 1px solid rgba(255, 215, 0, 0.3);
        padding-bottom: 15px;
    }

    .game-mode-header h1 {
        font-size: 28px;
        color: #ffd700;
        text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
        margin: 0;
        letter-spacing: 2px;
    }

    .game-mode-content {
        margin-bottom: 30px;
    }

    .mode-selection {
        display: flex;
        justify-content: center;
        gap: 30px;
        margin: 20px 0 40px;
    }

    .mode-item {
        background-color: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 215, 0, 0.3);
        border-radius: 10px;
        padding: 25px;
        width: 300px;
        text-align: center;
        cursor: pointer;
        transition: all 0.3s;
    }

    .mode-item:hover {
        transform: translateY(-10px);
        background-color: rgba(255, 255, 255, 0.15);
        box-shadow: 0 10px 20px rgba(255, 215, 0, 0.2);
    }

    .mode-icon {
        font-size: 50px;
        margin-bottom: 15px;
        color: #ffd700;
    }

    .mode-title {
        font-size: 24px;
        font-weight: bold;
        margin-bottom: 15px;
        color: #ffd700;
    }

    .mode-description {
        font-size: 16px;
        color: rgba(255, 255, 255, 0.8);
    }

    .game-mode-footer {
        display: flex;
        justify-content: center;
        margin-top: 20px;
        padding-top: 20px;
        border-top: 1px solid rgba(255, 215, 0, 0.3);
    }

    .menu-btn {
        display: flex;
        align-items: center;
        gap: 8px;
        background-color: rgba(255, 255, 255, 0.1);
        color: white;
        border: 1px solid rgba(255, 215, 0, 0.3);
        padding: 12px 25px;
        border-radius: 6px;
        font-size: 16px;
        font-weight: bold;
        cursor: pointer;
        transition: all 0.3s;
    }

    .menu-btn:hover {
        background-color: rgba(255, 255, 255, 0.2);
        transform: translateY(-3px);
    }

    @keyframes fadeIn {
        from {
            opacity: 0;
            transform: translateY(-20px) scale(0.95);
        }
        to {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
    }
</style>
